


export interface DeviceAddress {
    name: string,
    address: number,
}

export const ipc: DeviceAddress = {
    name: '工控机',
    address: 0,
}

export const weight: DeviceAddress = {
    name: '称重控制板',
    address: 1,
};

export const cargo1: DeviceAddress = {
    name: '货架控制板1',
    address: 2,
}

export const cargo2: DeviceAddress = {
    name: '货架控制板2',
    address: 3,
};

export const heat: DeviceAddress = {
    name: '加热控制板',
    address: 4,
};

export const door: DeviceAddress = {
    name: '门控制板',
    address: 5,
};

export const drop: DeviceAddress = {
    name: '切膜落杯控制板',
    address: 6,
};

export function deviceWithAddress(address: number) {
    switch (address) {
        case cargo1.address: return cargo1;
        case cargo2.address: return cargo2;
        case heat.address: return heat;
        case drop.address: return drop;
        case door.address: return door;
        default: throw 'invalid address'
    }
}

export const devices: DeviceAddress[] = [
    {
        name: '称重控制板',
        address: 1,
    }, {
        name: '货架控制板1',
        address: 2,
    }, {
        name: '货架控制板2',
        address: 3,
    }, {
        name: '加热控制板',
        address: 4,
    }, {
        name: '门控制板',
        address: 5,
    }, {
        name: '切膜落杯控制板',
        address: 6,
    }
]



